//
//  XinDianViewController.m
//  YYUnicode
//
//  Created by 蓓蕾 on 2021/7/31.
//

#import "XinDianViewController.h"
#import <AAChartKit.h>

@interface XinDianViewController ()

@property (nonatomic, strong) AAChartView *aaChartView;

@property (nonatomic, strong) AAChartModel *aaChartModel;

//@property (nonatomic, strong) AAOptions *aaChartOption;

@end

@implementation XinDianViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    NSLog(@"开始了");
    
    
    _aaChartView = [[AAChartView alloc]init];
    _aaChartView.frame = CGRectMake(10, 80, kScreenWidth - 20, 300);
    _aaChartView.scrollEnabled = NO;//是否允许滚动
    //_aaChartView.scrollEnabled = NO;
    [self.view addSubview:_aaChartView];
    
    
    _aaChartModel = [self configureColumnrangeMixedLineChart];
    _aaChartModel.markerSymbol = AAChartSymbolTypeCircle;//设置连接点为圆形
    [_aaChartView aa_drawChartWithChartModel:_aaChartModel];
}

- (AAChartModel *)configureColumnrangeMixedLineChart {
    
    
    return AAChartModel.new
    
    .yAxisMinSet(@0)
    .yAxisMaxSet(@10)
    .markerRadiusSet(@6)
    .legendEnabledSet(NO)//是否显示图例
    
    .yAxisVisibleSet(true)//y 轴是否可见(默认可见)
    .yAxisGridLineStyleSet([AALineStyle styleWithWidth:@0])
    .markerSymbolStyleSet(AAChartSymbolStyleTypeBorderBlank)
    .chartTypeSet(AAChartTypeLine)//图表类型
    //X轴数据
    .categoriesSet(@[@"2019.6", @"2019.12", @"2020.4", @"2020.11", @"2021.5"])
//    .dataLabelsEnabledSet(true)//设置所有图表是否显示value值
    .colorsThemeSet(@[@"#ecf5ff",@"#3c90f7", @"#55bfc0"])
    .seriesSet(@[
        AASeriesElement.new
        .nameSet(@"总胆固醇")
        .typeSet(AAChartTypeLine)//图表类型【折线图】
        .enableMouseTrackingSet(@NO)//是否允许用户交互（是否允许点击）
        .dataSet(@[@7, @4.8, @5, @7.3, @5.0]),
        AASeriesElement.new
        .typeSet(AAChartTypeLine)//图表类型【折线图】
        .enableMouseTrackingSet(@NO)
        .nameSet(@"甘油三酯")
        .dataSet(@[@4, @2, @3, @3.5, @3.6]),
        AASeriesElement.new
        .nameSet(@"胆固醇脂")
        .typeSet(AAChartTypeLine)//图表类型【折线图】【AAChartTypeSpline：曲线图】
        .enableMouseTrackingSet(@false)
        .dataSet(@[@4.2, @5, @5.4, @5.3, @5.1]),
    ]);
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
